home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000042_icon-group-sender _Wed May 27 08:20:59 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA03009
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 27 May 1998 08:20:58 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA32250; Wed, 27 May 1998 08:20:52 -0700
Message-Id: <4FD6422BE942D111908D00805F3158DF0757B2CE@red-msg-52.dns.microsoft.com>
From: Todd Proebsting <toddpro@microsoft.com>
To: "'Guy Laden'" <guy@math.tau.ac.il>, icon-group@baskerville.CS.Arizona.EDU
Subject: RE: Writing compilers in Icon
Date: Tue, 26 May 1998 13:22:48 -0700
X-Mailer: Internet Mail Service (5.5.2328.0)
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2106
I really enjoyed writing Jcon's translator in Icon. (I had help from Denise
Todd, Bob Alexander and Gregg Townsend.) I made little use of goal-directed
evaluation, although generators were great fun to use. In fact, the whole
translator setup is based on a series of co-expressions that feed one
another as a series of filters, which would have been very painful without
generators. For instance, to translate a file, file.icn, into ucode files
file.u1 and file.u2, the magic incantation is
% jtran preproc file.icn : yylex : parse : u_gen_File -out:file
This directs the translator to create a 4-stage pipe: preprocessing, lexing,
parsing, and generating ucode. Each stage is a co-expression that eats the
output of the previous co-expression as input. For fun, try the following
pipelines:
% jtran preproc file.icn : echo
% jtran preproc file.icn : yylex : echo
% jtran preproc file.icn : yylex : parse : echo
Each will give you some idea as to what each stage communicates to the next.
(NOTE: The colons must be separated from the commands by whitespace. Also,
"echo" filter can be given a "-verbose" flag for really chatty output.)
I don't have an Icon grammar that is suitable for recursive-descent parsing,
BUT jtran has just such a parser in it. Check the file tran/parse.icn.
(The command above that ends in "parse : echo" will give you some idea of
the abstract syntax trees built by the parser.)
Todd
-----Original Message-----
From: Guy Laden [mailto:guy@math.tau.ac.il]
Sent: Friday, May 22, 1998 1:15 PM
To: icon-group@baskerville.CS.Arizona.EDU
Subject: Writing compilers in Icon
I noticed the newly announced implementation of Jcon is written in Icon.
I was wondering whether anybody can comment on how suitable they
find Icon for writing compilers? Do any of Icon's unique features
prove especially useful for this task? I'm wondering more about
generators and goal-directed evaluation; the built-in data-structures
are obviously useful.
btw, does anybody have an Icon grammar they are willing to share
that is suitable for recursive descent parsing?
Regards,
Guy.